package app.fugema.shop.main.order.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class OrderParams implements Serializable
{
    // 立即购买时为 skuids 购物车下单时为 cartitemIds
    private String itemIds;
    private String counts;
    private List<ShopProduct> shopProducts;

    private int recieveAddressId;
    private boolean isCashOnDelivery;
    private String capitalAmount;
    private String integral;

    private String invoiceType;
    private int productType;

    private String couponIds;

    private String userkey;

    public String getCounts()
    {
        return counts;
    }

    public void setCounts(String counts)
    {
        this.counts = counts;
    }

    public int getRecieveAddressId()
    {
        return recieveAddressId;
    }

    public void setRecieveAddressId(int recieveAddressId)
    {
        this.recieveAddressId = recieveAddressId;
    }

    public String getCouponIds()
    {
        return couponIds;
    }

    public void setCouponIds(String couponIds)
    {
        this.couponIds = couponIds;
    }

    public String getIntegral()
    {
        return integral;
    }

    public void setIntegral(String integral)
    {
        this.integral = integral;
    }

    public boolean isCashOnDelivery()
    {
        return isCashOnDelivery;
    }

    public void setCashOnDelivery(boolean cashOnDelivery)
    {
        isCashOnDelivery = cashOnDelivery;
    }

    public String getInvoiceType()
    {
        return invoiceType;
    }

    public void setInvoiceType(String invoiceType)
    {
        this.invoiceType = invoiceType;
    }

    public String getUserkey()
    {
        return userkey;
    }

    public void setUserkey(String userkey)
    {
        this.userkey = userkey;
    }

    public String getItemIds()
    {
        return itemIds;
    }

    public void setItemIds(String itemIds)
    {
        this.itemIds = itemIds;
    }

    public List<ShopProduct> getShopProducts()
    {
        return shopProducts;
    }

    public void setShopProducts(List<ShopProduct> shopProducts)
    {
        this.shopProducts = shopProducts;
    }

    public String getCapitalAmount()
    {
        return capitalAmount;
    }

    public void setCapitalAmount(String capitalAmount)
    {
        this.capitalAmount = capitalAmount;
    }

    public int getProductType()
    {
        return productType;
    }

    public void setProductType(int productType)
    {
        this.productType = productType;
    }

    public static class ShopProduct
    {

        private String shopId;

        private List<OrderShops.OrderSku> orderSkus;

        private String remark;

        private int shopBrandId;

        //发票信息
        private OrderInvoiceBean PostOrderInvoice;

        public String getShopId()
        {
            return shopId;
        }

        public void setShopId(String shopId)
        {
            this.shopId = shopId;
        }

        public List<OrderShops.OrderSku> getOrderSkus()
        {
            return orderSkus;
        }

        public void setOrderSkus(List<OrderShops.OrderSku> orderSkus)
        {
            this.orderSkus = orderSkus;
        }

        public String getRemark()
        {
            return remark;
        }

        public void setRemark(String remark)
        {
            this.remark = remark;
        }

        public int getShopBrandId()
        {
            return shopBrandId;
        }

        public void setShopBrandId(int shopBrandId)
        {
            this.shopBrandId = shopBrandId;
        }

        public OrderInvoiceBean getPostOrderInvoice() {
            return PostOrderInvoice;
        }

        public void setPostOrderInvoice(OrderInvoiceBean postOrderInvoice) {
            PostOrderInvoice = postOrderInvoice;
        }
    }


    public static List<OrderShops.OrderSku> getOrderSkuListByCartItemModels(List<CartItemProductModel> cartItemModels)
    {
        List<OrderShops.OrderSku> orderSkus = new ArrayList<>();
        for (CartItemProductModel itemModel : cartItemModels)
        {
            OrderShops.OrderSku tempSku = new OrderShops.OrderSku();
            tempSku.setSkuId( itemModel.getSkuId() );
            tempSku.setCount( String.valueOf( itemModel.getCount() ) );
            orderSkus.add(tempSku);
        }
        return orderSkus;
    }
}
